using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WeaponHangSlot : MonoBehaviour
{
    public WepaonHangPoint wepaonHangPoint;
    private GameObject _currentHangedWeapon;

    public void HandleWeaponHang(GameObject weaponPrefab)
    {
        GameObject weapon = PoolManager.Instance.Get(weaponPrefab, (weapon) =>
        {
            weapon.transform.position = transform.position;
            weapon.transform.rotation = Quaternion.identity;
            
            weapon.transform.SetParent(transform);
        });
        _currentHangedWeapon = weapon;
    }

    public void DestoryWeapon()
    {
        if (_currentHangedWeapon != null)
        {
            PoolManager.Instance.Delease(_currentHangedWeapon);
            _currentHangedWeapon = null;
        }
    }
}
